package com.fsxgt.datagrid.flow.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.fsxgt.datagrid.core.utils.ReturnT;
import com.fsxgt.datagrid.flow.bo.FlowInfoBO;
import com.fsxgt.datagrid.flow.service.impl.FlowService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@Api(tags = "流程引擎接口", value = "FlowController")
@RequestMapping(produces = "application/json; charset=UTF-8",path = "/flow")
@RestController
public class FlowController extends BaseController {

	@Autowired
	private FlowService flowService;


	@ApiOperation(hidden = true, value = "保存流程", notes = "")
	@RequestMapping(path = "/saveFlow", method = RequestMethod.POST)
	public ReturnT saveFlow(@RequestBody FlowInfoBO flowInfoBO, HttpServletRequest request) throws Exception {



		flowService.saveFlow(flowInfoBO);
		
		return new ReturnT();

	}
	
	@ApiOperation(hidden = true, value = "查询流程", notes = "")
	@RequestMapping(path = "/getFlow", method = RequestMethod.POST)
	public ReturnT getFlow(@RequestBody FlowInfoBO flowInfoBO, HttpServletRequest request) {



		FlowInfoBO list = flowService.getFlow(flowInfoBO.getId());
		
		return new ReturnT(list);

	}

	

}